#include "Mesh.h"


Mesh::Mesh() 
{
	vertices.clear();
	indices.clear();
}


Mesh::~Mesh()
{
}

void Mesh::AddVertex(Vertex v)
{
	vertices.push_back(v);
}
void Mesh::AddVertex(float x, float y, float z, float nx, float ny, float nz, float u, float v)
{
	vertices.push_back({XMFLOAT3(x,y,z),XMFLOAT3(nx,ny,nz),XMFLOAT2(u,v)});
}

void Mesh::AddTriangle(short v1, short v2, short v3)
{
	indices.push_back(v1);
	indices.push_back(v2);
	indices.push_back(v3);
}

Vertex* Mesh::GetVertices()
{
	Vertex* retTab = new Vertex[vertices.size()];
	for (int i = 0; i < vertices.size(); ++i){
		retTab[i] = vertices[i];
	};
	return retTab;
}

short* Mesh::GetIndices()
{
	short* retTab = new short[indices.size()];
	for (int i = 0; i < indices.size(); ++i){
		retTab[i] = indices[i];
	}
	return retTab;
}

